package kr.hkit.powerjava.chapter13.work;

import java.awt.Dimension;
import java.awt.HeadlessException;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class MyFrame extends JFrame {
	public MyFrame() throws HeadlessException {
		init();
	}

	private void init() {
		Toolkit tool = Toolkit.getDefaultToolkit();
		Dimension screenSize = tool.getScreenSize();
		Dimension frameSize = new Dimension(600,150);
		
		int x = (int) (screenSize.getWidth()/2 - frameSize.getWidth()/2);
		int y = (int) (screenSize.getHeight()/2 - frameSize.getHeight()/2);
		
		setLocation(x,y);
		setSize(frameSize);
		
		setTitle("MyFrame");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		BtnPanel bp = new BtnPanel();
		HeaderPanel hp = new HeaderPanel();
		JPanel p = new JPanel();
		p.add(hp);
		p.add(bp);
		
		add(p);
		pack();
		setVisible(true);
		
	}


}
